Skip to content

LibGfx/JPEG: Add a deringing pass to the encoder#26313

Merged
LucasChollet merged 1 commit intoSerenityOS:masterfrom
LucasChollet:jpeg_deringing
Feb 27, 2026
Merged

LibGfx/JPEG: Add a deringing pass to the encoder#26313
LucasChollet merged 1 commit intoSerenityOS:masterfrom
LucasChollet:jpeg_deringing

Conversation

@LucasChollet
Copy link
Copy Markdown
Member

The idea is described here https://kornel.ski/deringing/. And allows reducing the noise around sharp white edges. This is visible when encoding an image like buggie.png. One nice aspect of the optimization is that it only affects macroblocks where it can help.


Before:
buggie_master

After:
buggie

Diff:
diff

@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Oct 24, 2025
@stale
Copy link
Copy Markdown

stale bot commented Nov 14, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Nov 14, 2025
@nico nico removed the stale label Nov 14, 2025
@stale
Copy link
Copy Markdown

stale bot commented Dec 6, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Dec 6, 2025
@LucasChollet LucasChollet removed the stale label Dec 6, 2025
The idea is described here https://kornel.ski/deringing/. And allows
reducing the noise around sharp white edges. This is visible when
encoding an image like `buggie.png`. One nice aspect of the optimization
is that it only affects macroblocks where it can help.
@stale
Copy link
Copy Markdown

stale bot commented Dec 28, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Dec 28, 2025
@stale
Copy link
Copy Markdown

stale bot commented Jan 5, 2026

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

@stale stale bot closed this Jan 5, 2026
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Jan 5, 2026
@LucasChollet LucasChollet reopened this Jan 5, 2026
@github-actions github-actions bot added the 👀 pr-needs-review PR needs review from a maintainer or community member label Jan 5, 2026
@stale stale bot removed the stale label Jan 5, 2026
@LucasChollet
Copy link
Copy Markdown
Member Author

@nico do you want to take a look at this?

@nico
Copy link
Copy Markdown
Contributor

nico commented Jan 7, 2026

@nico do you want to take a look at this?

I do! I did look at it a few weeks ago and it looked sufficiently different from ImageOptim/mozjpeg-cocoa@ecb1751 that I got scared, decided I needed more time, and then didn't get back to it. If you're reasonably confident that it's good, feel free to just hit merge! :)

@LucasChollet
Copy link
Copy Markdown
Member Author

I think it's good to go, but I always like your feedback so I'll let the PR open until the next round of the stale bot.

@stale
Copy link
Copy Markdown

stale bot commented Jan 31, 2026

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@stale stale bot added the stale label Jan 31, 2026
@nico nico removed the stale label Jan 31, 2026
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

@github-actions github-actions bot added the stale label Feb 22, 2026
@LucasChollet
Copy link
Copy Markdown
Member Author

It's time to get that in tree!

@LucasChollet LucasChollet merged commit 97b8178 into SerenityOS:master Feb 27, 2026
28 checks passed
@LucasChollet LucasChollet deleted the jpeg_deringing branch February 27, 2026 16:42
@github-actions github-actions bot removed the 👀 pr-needs-review PR needs review from a maintainer or community member label Feb 27, 2026
Copy link
Copy Markdown
Contributor

@nico nico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I had a pending nit. Feel free to ignore!

What confused me when looking at this is that the linked-to method seems to do more, like clipping at both min and max ends, while this one I think only clips at max. But can't argue with the screenshots :) And I don't fully understand the linked-to method yet, so maybe I'm misunderstanding what it (and this) does.

Thanks for the patch, very cool!

Comment thread Userland/Libraries/LibGfx/ImageFormats/JPEGWriter.h
@LucasChollet
Copy link
Copy Markdown
Member Author

It does indeed only cover the top of the curve, so there are some gains to get in the dark regions too! They are probably less noticeable though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants